import 'package:flutter/material.dart';
import 'package:wechat/pages/const.dart';

class FriendsCell extends StatelessWidget {
  final String? imageUrl;
  final String? username;
  final String? assetImage;
  final String? firstLetter;

  FriendsCell({
    this.imageUrl,
    this.username,
    this.assetImage,
    this.firstLetter,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      child: Column(
        children: [
          Container(
            alignment: Alignment.centerLeft,
            padding: EdgeInsets.only(left: 10,),
            color: Color.fromRGBO(0, 0, 0, 0.1),
            height: firstLetter != null ? 30.0 : 0.0 ,
            width: ScreenWidth(context),
            child: firstLetter != null ? Text(firstLetter!) : null,
          ),
          Row(
            children: [
              Container(
                margin: EdgeInsets.all(10),
                width: 34,
                height: 34,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  image: DecorationImage(
                    image: imageUrl != null
                        ? NetworkImage(imageUrl!)
                        : AssetImage(assetImage!) as ImageProvider,
                  ),
                ),
              ),
              Container(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Container(
                      alignment: Alignment.center,
                        // color: Colors.yellow,
                        height: 53.5,
                        child: Text(
                          username!,
                          style: TextStyle(
                            fontSize: 18,
                            // backgroundColor: Colors.blue,
                          ),
                        )),
                    Container(
                      color: wechatThemeColor,
                      height: 0.5,
                      width: ScreenWidth(context) - 54,
                    ),
                  ],
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
